POV-Ray : Newsgroups : povray.general : Script language speed : Re: Script language speed Server Time
7 Aug 2024 05:18:21 EDT (-0400)
  Re: Script language speed  
From: Andrew
Date: 5 Nov 2001 11:02:05
Message: <3be6b7fd$1@news.povray.org>
Theoretically then, a performance increase could be gained by unrolling
loops of fixed length?  For example, if this piece of code...

#declare loop=0;
#while (loop<10)
    #declare my_array [loop] = loop;
    #declare loop=loop+1;
    #end

...appeared in the middle of a macro called hundreds and hundreds of
times, would the scene parse faster if the following were substituted?

#declare my_array [0] = 0;
#declare my_array [1] = 1;
#declare my_array [2] = 2;
#declare my_array [3] = 3;
#declare my_array [4] = 4;
#declare my_array [5] = 5;
#declare my_array [6] = 6;
#declare my_array [7] = 7;
#declare my_array [8] = 8;
#declare my_array [9] = 9;

Presumably it would as there would be fewer I/O calls to seek back to
the beginning of the loop each time.  Or am I simply wrong :-) ?


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.